package com.woniu.cq.medical.dao.mymapper;

import com.woniu.cq.medical.dao.CaseChangeInfoMapper;
import com.woniu.cq.medical.entity.CaseChangeInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Primary;

import java.util.List;

/**
 * @Author: Klaus
 * @Date: 2020/9/9 11:34
 */
@Primary

public interface My_CaseChangeInfoMapper extends CaseChangeInfoMapper {

    /**
     * 根据身份证查询病人的病例修改记录
     * @param idCard
     * @return
     */
    @Select("SELECT case_change_info_id,case_id,case_patient_name,\n" +
            "case_sex,case_access_time,case_birthdate,\n" +
            "case_age,case_phone_number,case_address,\n" +
            "case_attack_date,user_id,case_admission_count,\n" +
            "case_morbidity,case_initial_diagnose,doctor_id,\n" +
            "case_competent_physician,case_final_diagnose,case_discharge_date,\n" +
            "prescription_id,case_discharge_condition,case_comment,\n" +
            "case_is_pigeonhole,case_final_update_date,case_patient_id_card\n" +
            "from lonbon_case_change_info where case_patient_id_card = #{idCard}")
    List<CaseChangeInfo> selectCaseChangeInfoByIdCard(String idCard);

    @Select("SELECT case_change_info_id,case_id,case_patient_name,\n" +
            "case_sex,case_access_time,case_birthdate,\n" +
            "case_age,case_phone_number,case_address,\n" +
            "case_attack_date,user_id,case_admission_count,\n" +
            "case_morbidity,case_initial_diagnose,doctor_id,\n" +
            "case_competent_physician,case_final_diagnose,case_discharge_date,\n" +
            "prescription_id,case_discharge_condition,case_comment,\n" +
            "case_is_pigeonhole,case_final_update_date,case_patient_id_card\n" +
            "from lonbon_case_change_info where case_patient_id_card = #{idCard} and case_id = #{caseId}")
    List<CaseChangeInfo> selectPatientByIdCardAndCaseId(@Param("idCard") String idCard,@Param("caseId") String caseId);
}
